import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  base:"./", //打包路径
  resolve: {
    alias:{
      '@': path.resolve(__dirname, './src')//设置别名
    }
  },
  server: {
    port: 4000, //启动端口
    open: true,
    proxy: {
      // 选项写法
      '/api': 'http://127.0.0.1:5000'//dev
      // '/api': 'http://127.0.0.1:5000'//ci
      // '/api': 'http://127.0.0.1:5000'//stg1
      // '/api': 'http://127.0.0.1:5000'//stg2
      // '/api': 'http://127.0.0.1:5000'//gray
      // '/api': 'http://127.0.0.1:5000'//prod
    },
    cors:true
  },
  css: {
    preprocessorOptions: {
      less: {
        modifyVars: {
          hack: `true; @import (reference) "${path.resolve(__dirname, './src/theme/var.less')}";`,
        },
        javascriptEnabled: true,
      }
    }
  }

})

